package com.dahaiwuliang.code.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Entity
@Table (name = "message")
@JsonIgnoreProperties (value = {"hibernateLazyInitializer","hander","fieldHandler"})
public class Message implements Serializable {

    private static final long serialVersionUID = -3019122891322908878L;
    @Id
    @GeneratedValue (strategy = GenerationType.IDENTITY)
    private Integer messageId;          //资源id

    @Column(length = 100)
    private  String content;//消息内容
    @Column(length = 100)
    private  String cause;//原因

    @JsonFormat (pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat (pattern = "yyyy-MM-dd HH:mm:ss")
    private Date publishDate;      //发布时间

    @ManyToOne
    @JoinColumn(name="user_id")
    private User user;                  //所属用户

    private  boolean isSee=false;  //信息是否被查看；

    public Integer getMessageId() {
        return messageId;
    }

    public void setMessageId(Integer messageId) {
        this.messageId = messageId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getCause() {
        return cause;
    }

    public void setCause(String cause) {
        this.cause = cause;
    }

    public Date getPublishDate() {
        return publishDate;
    }

    public void setPublishDate(Date publishDate) {
        this.publishDate = publishDate;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public boolean isSee() {
        return isSee;
    }

    public void setSee(boolean see) {
        isSee = see;
    }
}
